
import MaterialProperty from '../../MaterialProperty'

import iChannel0 from '../../image/water/Water_1_M_Normal.jpg'
import iChannel1 from '../../image/water/water1.webp'

class FlowWaterMaterialProperty extends MaterialProperty {
  constructor(options = {}) {
    super(options)
    this._iChannel0 = undefined
    this._iChannel1 = undefined
    this._iChannel0Subscription = undefined
    this._iChannel1Subscription = undefined
    this.iChannel0 = options.iChannel0 || iChannel0
    this.iChannel1 = options.iChannel1 || iChannel1
  }

  // 获取类型
  getType(time) {
    return Cesium.Material.FlowWaterMaterialType
  }

  getValue(time, result) {
    if (!result) {
      result = {}
    }
    result.color = Cesium.Property.getValueOrUndefined(this.color, time)
    result.speed = Cesium.Property.getValueOrUndefined(this.speed, time)
    result.iChannel0 = Cesium.Property.getValueOrUndefined(this.iChannel0, time)
    result.iChannel1 = Cesium.Property.getValueOrUndefined(this.iChannel1, time)
    return result
  }

  equals(other) {
    return this === other
  }
}

Object.defineProperties(FlowWaterMaterialProperty.prototype, {
  color: Cesium.createPropertyDescriptor('color'),
  speed: Cesium.createPropertyDescriptor('speed'),
  iChannel0: Cesium.createPropertyDescriptor('iChannel0'),
  iChannel1: Cesium.createPropertyDescriptor('iChannel1')
})

export default FlowWaterMaterialProperty